using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace EFDataBase.Models.Mapping
{
    public class Orders_RecordMap : EntityTypeConfiguration<Orders_Record>
    {
        public Orders_RecordMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.id)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.openid)
                .HasMaxLength(50);

            this.Property(t => t.building)
                .HasMaxLength(100);

            this.Property(t => t.dorm)
                .HasMaxLength(50);

            this.Property(t => t.phone)
                .HasMaxLength(50);

            this.Property(t => t.pruduct_id)
                .HasMaxLength(50);

            this.Property(t => t.amount)
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.payway)
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.payed)
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.leave_word)
                .HasMaxLength(350);

            this.Property(t => t.sended)
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.deletes)
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.finished)
                .IsFixedLength()
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("Orders_Record");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.openid).HasColumnName("openid");
            this.Property(t => t.building).HasColumnName("building");
            this.Property(t => t.dorm).HasColumnName("dorm");
            this.Property(t => t.phone).HasColumnName("phone");
            this.Property(t => t.pruduct_id).HasColumnName("pruduct_id");
            this.Property(t => t.amount).HasColumnName("amount");
            this.Property(t => t.payway).HasColumnName("payway");
            this.Property(t => t.payed).HasColumnName("payed");
            this.Property(t => t.leave_word).HasColumnName("leave_word");
            this.Property(t => t.sended).HasColumnName("sended");
            this.Property(t => t.deletes).HasColumnName("deletes");
            this.Property(t => t.finished).HasColumnName("finished");
            this.Property(t => t.createtime).HasColumnName("createtime");
        }
    }
}
